| Total Complexity | 8 |
| Total Lines | 62 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | class NodeForm { |
||
| 2 | /** |
||
| 3 | * Show this form in a jQueryUI dialog |
||
| 4 | * |
||
| 5 | * @return {void} |
||
| 6 | */ |
||
| 7 | show() { |
||
| 8 | this.hasBeenOpened = true; |
||
| 9 | this.$form.dialog({ |
||
| 10 | title: this.name, |
||
| 11 | closeText: LANG.plugins.prosemirror.cancel, |
||
|
|
|||
| 12 | width: 800, |
||
| 13 | appendTo: '.dokuwiki', |
||
| 14 | modal: true, |
||
| 15 | open: () => { |
||
| 16 | const TIMEOUT_TO_LOOK_SMOOTH = 50; |
||
| 17 | window.setTimeout(() => { |
||
| 18 | // hack to ensure this dialog is in front of other open dialogs, e.g. the footnote dialog. |
||
| 19 | this.$form.dialog('moveToTop'); |
||
| 20 | }, TIMEOUT_TO_LOOK_SMOOTH); |
||
| 21 | }, |
||
| 22 | }); |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Hide this form/dialog |
||
| 27 | * |
||
| 28 | * @return {void} |
||
| 29 | */ |
||
| 30 | hide() { |
||
| 31 | if (this.hasBeenOpened) { |
||
| 32 | this.$form.dialog('close'); |
||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Bind a callback to an event on the form |
||
| 38 | * |
||
| 39 | * @param {string} eventName name of the event, can contain namespaces (e.g. click.myPlugin ) |
||
| 40 | * @param {function} callback the handler function to be attached to the event |
||
| 41 | * |
||
| 42 | * @return {void} |
||
| 43 | */ |
||
| 44 | on(eventName, callback) { |
||
| 45 | this.$form.on(eventName, callback); |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Remove a handler from an event |
||
| 50 | * |
||
| 51 | * @param {string} eventName name of the event, can contain namespaces (e.g. click.myPlugin ) |
||
| 52 | * |
||
| 53 | * @return {void} |
||
| 54 | */ |
||
| 55 | off(eventName) { |
||
| 56 | this.$form.off(eventName); |
||
| 57 | } |
||
| 58 | |||
| 59 | destroy() { |
||
| 60 | this.$form.remove(); |
||
| 61 | } |
||
| 62 | } |
||
| 63 | |||
| 65 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.